home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12112 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. From: theOnlyHeretic@msn.com (John West)
  2. Subject: RE: Help, writeing initializing graphics
  3. Date: 29 Mar 96 06:35:12 -0800
  4. References: <4j4qpb$jra@tribune.usask.ca>
  5. Message-ID: <00001a80+00008b59@msn.com>
  6. Path: news.msn.com!msn.com
  7. Newsgroups: comp.lang.c
  8. Organization: The Microsoft Network (msn.com)
  9.  
  10. Hi Alan, Yeah I kind a know what you mean. Kay, you said you have an 
  11. IBM so I'm gonna assume your probably working from a DOS or DOS 
  12. compatable environment; although, BIOS should transend that. 
  13. In C to cause an interupt you need to call _int86 or one of the other 
  14. flavors of this function. (alternatively use the inline assembler the 
  15. probably is inherent in your compiler) Along with int86 you need to 
  16. use Union REGS Which is a special struction designed to 'mimick' the 
  17. registers of the X86 types of CPU's. 
  18.     The BIOS Functions that deal with Video are INT 10h functions. I'm 
  19. not even Going to list all of the 10h toys 'cause theres alot of 
  20. them. The one you asked for is Function 00h (Set Video Mode). You 
  21. didn't mention what mode you want to put it in so I'll guess and say 
  22. your a game programmer and want a nice friendly 320X200 256 color 
  23. mode that every VGA video card (and it's parent, so I'm told) can 
  24. support.
  25. So we've done alittle back ground, Ready for some code?
  26.  
  27.  
  28. #Include <DOS.H>
  29. #define VGA    0x13
  30. Void Set_Mode () // Sets the current video mode to 320X200 X256
  31. {
  32.     Union REGS InRegs, OutRegs;
  33.     InRegs.h.ah=VGA; //Load the Function into AH Register
  34.     _int86(0x10,&InRegs, &OutRegs);
  35.     return;
  36. }
  37.  
  38. Blamo! Your in 320X200 256 color Graphics. Address 0xA0000 Is the 
  39. Starting point of Video memory with this mode and from there the fun 
  40. starts. 
  41. Having said all of this I have to admit it's alot. What you really 
  42. need is a Good Assembly Book (I reccomend "The Revolutionary Guide To 
  43. Assembly", WROX books, By Vitaly Maljugin and others. It reads well 
  44. has plenty of source code for examples, and tells you how to do 
  45. everything in DOS, BIOS, and where possible at the HARDWARE level.) 
  46. Additionally, take a cruise through your help files that come with 
  47. your compiler. Often times looking over what functions go in what 
  48. header files can give you some great starting points. ie, what's in 
  49. graphics.h? Also take a closer look at the Contents of union regs. 
  50. Let me know if this helped out some. My email is 
  51. theOnlyHeretic@msn.com.Goodluck!
  52.     
  53.